3.3.32 \(\int \frac {\tan ^2(e+f x)}{(a+b \tan ^2(e+f x))^2} \, dx\) [232]

Optimal. Leaf size=90 \[ -\frac {x}{(a-b)^2}+\frac {(a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} (a-b)^2 \sqrt {b} f}+\frac {\tan (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )} \]

[Out]

-x/(a-b)^2+1/2*(a+b)*arctan(b^(1/2)*tan(f*x+e)/a^(1/2))/(a-b)^2/f/a^(1/2)/b^(1/2)+1/2*tan(f*x+e)/(a-b)/f/(a+b*
tan(f*x+e)^2)

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3751, 482, 536, 209, 211} \begin {gather*} \frac {(a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} \sqrt {b} f (a-b)^2}+\frac {\tan (e+f x)}{2 f (a-b) \left (a+b \tan ^2(e+f x)\right )}-\frac {x}{(a-b)^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[e + f*x]^2/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-(x/(a - b)^2) + ((a + b)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(2*Sqrt[a]*(a - b)^2*Sqrt[b]*f) + Tan[e + f*
x]/(2*(a - b)*f*(a + b*Tan[e + f*x]^2))

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 482

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[e^(n - 1
)*(e*x)^(m - n + 1)*(a + b*x^n)^(p + 1)*((c + d*x^n)^(q + 1)/(n*(b*c - a*d)*(p + 1))), x] - Dist[e^n/(n*(b*c -
 a*d)*(p + 1)), Int[(e*x)^(m - n)*(a + b*x^n)^(p + 1)*(c + d*x^n)^q*Simp[c*(m - n + 1) + d*(m + n*(p + q + 1)
+ 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, q}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1] && GeQ[n
, m - n + 1] && GtQ[m - n + 1, 0] && IntBinomialQ[a, b, c, d, e, m, n, p, q, x]

Rule 536

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps

\begin {align*} \int \frac {\tan ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac {\text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\tan (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {\text {Subst}\left (\int \frac {1-x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{2 (a-b) f}\\ &=\frac {\tan (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{(a-b)^2 f}+\frac {(a+b) \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{2 (a-b)^2 f}\\ &=-\frac {x}{(a-b)^2}+\frac {(a+b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} (a-b)^2 \sqrt {b} f}+\frac {\tan (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.39, size = 87, normalized size = 0.97 \begin {gather*} \frac {-2 (e+f x)+\frac {(a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a} \sqrt {b}}+\frac {(a-b) \sin (2 (e+f x))}{a+b+(a-b) \cos (2 (e+f x))}}{2 (a-b)^2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[e + f*x]^2/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(-2*(e + f*x) + ((a + b)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(Sqrt[a]*Sqrt[b]) + ((a - b)*Sin[2*(e + f*x)]
)/(a + b + (a - b)*Cos[2*(e + f*x)]))/(2*(a - b)^2*f)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 83, normalized size = 0.92

method result size
derivativedivides \(\frac {-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{\left (a -b \right )^{2}}+\frac {\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {\left (a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}}{\left (a -b \right )^{2}}}{f}\) \(83\)
default \(\frac {-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{\left (a -b \right )^{2}}+\frac {\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {\left (a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}}{\left (a -b \right )^{2}}}{f}\) \(83\)
risch \(-\frac {x}{a^{2}-2 a b +b^{2}}+\frac {i \left (a \,{\mathrm e}^{2 i \left (f x +e \right )}+b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )}{f \left (a -b \right )^{2} \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}-b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i a b -\sqrt {-a b}\, a -\sqrt {-a b}\, b}{\left (a -b \right ) \sqrt {-a b}}\right ) a}{4 \sqrt {-a b}\, \left (a -b \right )^{2} f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i a b -\sqrt {-a b}\, a -\sqrt {-a b}\, b}{\left (a -b \right ) \sqrt {-a b}}\right ) b}{4 \sqrt {-a b}\, \left (a -b \right )^{2} f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i a b +\sqrt {-a b}\, a +\sqrt {-a b}\, b}{\left (a -b \right ) \sqrt {-a b}}\right ) a}{4 \sqrt {-a b}\, \left (a -b \right )^{2} f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i a b +\sqrt {-a b}\, a +\sqrt {-a b}\, b}{\left (a -b \right ) \sqrt {-a b}}\right ) b}{4 \sqrt {-a b}\, \left (a -b \right )^{2} f}\) \(382\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(-1/(a-b)^2*arctan(tan(f*x+e))+1/(a-b)^2*((1/2*a-1/2*b)*tan(f*x+e)/(a+b*tan(f*x+e)^2)+1/2*(a+b)/(a*b)^(1/2
)*arctan(b*tan(f*x+e)/(a*b)^(1/2))))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 101, normalized size = 1.12 \begin {gather*} \frac {\frac {{\left (a + b\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} - \frac {2 \, {\left (f x + e\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (f x + e\right )}{{\left (a b - b^{2}\right )} \tan \left (f x + e\right )^{2} + a^{2} - a b}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/2*((a + b)*arctan(b*tan(f*x + e)/sqrt(a*b))/((a^2 - 2*a*b + b^2)*sqrt(a*b)) - 2*(f*x + e)/(a^2 - 2*a*b + b^2
) + tan(f*x + e)/((a*b - b^2)*tan(f*x + e)^2 + a^2 - a*b))/f

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 176 vs. \(2 (81) = 162\).
time = 2.54, size = 409, normalized size = 4.54 \begin {gather*} \left [-\frac {8 \, a b^{2} f x \tan \left (f x + e\right )^{2} + 8 \, a^{2} b f x + {\left ({\left (a b + b^{2}\right )} \tan \left (f x + e\right )^{2} + a^{2} + a b\right )} \sqrt {-a b} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} - 4 \, {\left (b \tan \left (f x + e\right )^{3} - a \tan \left (f x + e\right )\right )} \sqrt {-a b}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right ) - 4 \, {\left (a^{2} b - a b^{2}\right )} \tan \left (f x + e\right )}{8 \, {\left ({\left (a^{3} b^{2} - 2 \, a^{2} b^{3} + a b^{4}\right )} f \tan \left (f x + e\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f\right )}}, -\frac {4 \, a b^{2} f x \tan \left (f x + e\right )^{2} + 4 \, a^{2} b f x - {\left ({\left (a b + b^{2}\right )} \tan \left (f x + e\right )^{2} + a^{2} + a b\right )} \sqrt {a b} \arctan \left (\frac {{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt {a b}}{2 \, a b \tan \left (f x + e\right )}\right ) - 2 \, {\left (a^{2} b - a b^{2}\right )} \tan \left (f x + e\right )}{4 \, {\left ({\left (a^{3} b^{2} - 2 \, a^{2} b^{3} + a b^{4}\right )} f \tan \left (f x + e\right )^{2} + {\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f\right )}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

[-1/8*(8*a*b^2*f*x*tan(f*x + e)^2 + 8*a^2*b*f*x + ((a*b + b^2)*tan(f*x + e)^2 + a^2 + a*b)*sqrt(-a*b)*log((b^2
*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 - 4*(b*tan(f*x + e)^3 - a*tan(f*x + e))*sqrt(-a*b))/(b^2*tan(f*x
+ e)^4 + 2*a*b*tan(f*x + e)^2 + a^2)) - 4*(a^2*b - a*b^2)*tan(f*x + e))/((a^3*b^2 - 2*a^2*b^3 + a*b^4)*f*tan(f
*x + e)^2 + (a^4*b - 2*a^3*b^2 + a^2*b^3)*f), -1/4*(4*a*b^2*f*x*tan(f*x + e)^2 + 4*a^2*b*f*x - ((a*b + b^2)*ta
n(f*x + e)^2 + a^2 + a*b)*sqrt(a*b)*arctan(1/2*(b*tan(f*x + e)^2 - a)*sqrt(a*b)/(a*b*tan(f*x + e))) - 2*(a^2*b
 - a*b^2)*tan(f*x + e))/((a^3*b^2 - 2*a^2*b^3 + a*b^4)*f*tan(f*x + e)^2 + (a^4*b - 2*a^3*b^2 + a^2*b^3)*f)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 2113 vs. \(2 (73) = 146\).
time = 15.32, size = 2113, normalized size = 23.48 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)**2/(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((zoo*x/tan(e)**2, Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), ((-x - 1/(f*tan(e + f*x)))/b**2, Eq(a, 0)), (f*x*
tan(e + f*x)**4/(8*b**2*f*tan(e + f*x)**4 + 16*b**2*f*tan(e + f*x)**2 + 8*b**2*f) + 2*f*x*tan(e + f*x)**2/(8*b
**2*f*tan(e + f*x)**4 + 16*b**2*f*tan(e + f*x)**2 + 8*b**2*f) + f*x/(8*b**2*f*tan(e + f*x)**4 + 16*b**2*f*tan(
e + f*x)**2 + 8*b**2*f) + tan(e + f*x)**3/(8*b**2*f*tan(e + f*x)**4 + 16*b**2*f*tan(e + f*x)**2 + 8*b**2*f) -
tan(e + f*x)/(8*b**2*f*tan(e + f*x)**4 + 16*b**2*f*tan(e + f*x)**2 + 8*b**2*f), Eq(a, b)), (x*tan(e)**2/(a + b
*tan(e)**2)**2, Eq(f, 0)), ((-x + tan(e + f*x)/f)/a**2, Eq(b, 0)), (a**2*log(-sqrt(-a/b) + tan(e + f*x))/(4*a*
*3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b
)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - a**2*log(sqrt(-a/b) + tan(e
 + f*x))/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b*
*3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - 4*a*b*f*x*sqr
t(-a/b)/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**
3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) + 2*a*b*sqrt(-a/
b)*tan(e + f*x)/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) -
 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) + a*b*lo
g(-sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**2/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**
2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-
a/b)*tan(e + f*x)**2) + a*b*log(-sqrt(-a/b) + tan(e + f*x))/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*
tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4
*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - a*b*log(sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**2/(4*a**3*b*f*sqrt(-a/b
) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**
2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - a*b*log(sqrt(-a/b) + tan(e + f*x))/(4*a**3*
b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*t
an(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - 4*b**2*f*x*sqrt(-a/b)*tan(e +
f*x)**2/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**
3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) - 2*b**2*sqrt(-a
/b)*tan(e + f*x)/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b)
- 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2) + b**2*
log(-sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**2/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*b**2*f*sqrt(-a/b)*tan(e + f*x)
**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**3*f*sqrt(-a/b) + 4*b**4*f*sqrt
(-a/b)*tan(e + f*x)**2) - b**2*log(sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**2/(4*a**3*b*f*sqrt(-a/b) + 4*a**2*
b**2*f*sqrt(-a/b)*tan(e + f*x)**2 - 8*a**2*b**2*f*sqrt(-a/b) - 8*a*b**3*f*sqrt(-a/b)*tan(e + f*x)**2 + 4*a*b**
3*f*sqrt(-a/b) + 4*b**4*f*sqrt(-a/b)*tan(e + f*x)**2), True))

________________________________________________________________________________________

Giac [A]
time = 0.85, size = 112, normalized size = 1.24 \begin {gather*} \frac {\frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )\right )} {\left (a + b\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} - \frac {2 \, {\left (f x + e\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (f x + e\right )}{{\left (b \tan \left (f x + e\right )^{2} + a\right )} {\left (a - b\right )}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*((pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b)))*(a + b)/((a^2 - 2*a*b + b^2)*sqr
t(a*b)) - 2*(f*x + e)/(a^2 - 2*a*b + b^2) + tan(f*x + e)/((b*tan(f*x + e)^2 + a)*(a - b)))/f

________________________________________________________________________________________

Mupad [B]
time = 13.04, size = 2136, normalized size = 23.73 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )}{2\,f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a\right )\,\left (a-b\right )}-\frac {2\,\mathrm {atan}\left (\frac {\frac {\frac {-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{2\,\left (a^2-2\,a\,b+b^2\right )\,\left (2\,a^2-4\,a\,b+2\,b^2\right )}+\frac {\left (2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6\right )\,1{}\mathrm {i}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}}{2\,a^2-4\,a\,b+2\,b^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}}{2\,a^2-4\,a\,b+2\,b^2}-\frac {\frac {\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{2\,\left (a^2-2\,a\,b+b^2\right )\,\left (2\,a^2-4\,a\,b+2\,b^2\right )}+\frac {\left (2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6\right )\,1{}\mathrm {i}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}}{2\,a^2-4\,a\,b+2\,b^2}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}}{2\,a^2-4\,a\,b+2\,b^2}}{\frac {\frac {\left (-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{2\,\left (a^2-2\,a\,b+b^2\right )\,\left (2\,a^2-4\,a\,b+2\,b^2\right )}+\frac {\left (2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6\right )\,1{}\mathrm {i}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}\right )\,1{}\mathrm {i}}{2\,a^2-4\,a\,b+2\,b^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )\,1{}\mathrm {i}}{2\,\left (a^2-2\,a\,b+b^2\right )}}{2\,a^2-4\,a\,b+2\,b^2}+\frac {\frac {\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{2\,\left (a^2-2\,a\,b+b^2\right )\,\left (2\,a^2-4\,a\,b+2\,b^2\right )}+\frac {\left (2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6\right )\,1{}\mathrm {i}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}\right )\,1{}\mathrm {i}}{2\,a^2-4\,a\,b+2\,b^2}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )\,1{}\mathrm {i}}{2\,\left (a^2-2\,a\,b+b^2\right )}}{2\,a^2-4\,a\,b+2\,b^2}+\frac {\frac {b^2}{2}+\frac {a\,b}{2}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}}\right )}{f\,\left (2\,a^2-4\,a\,b+2\,b^2\right )}-\frac {\mathrm {atan}\left (\frac {\frac {\sqrt {-a\,b}\,\left (a+b\right )\,\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}-\frac {\left (\frac {2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (a+b\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{8\,\left (a^2-2\,a\,b+b^2\right )\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,\sqrt {-a\,b}\,\left (a+b\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,1{}\mathrm {i}}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}+\frac {\sqrt {-a\,b}\,\left (a+b\right )\,\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}+\frac {\left (\frac {2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (a+b\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{8\,\left (a^2-2\,a\,b+b^2\right )\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,\sqrt {-a\,b}\,\left (a+b\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,1{}\mathrm {i}}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}}{\frac {\frac {b^2}{2}+\frac {a\,b}{2}}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}-\frac {\sqrt {-a\,b}\,\left (a+b\right )\,\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}-\frac {\left (\frac {2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (a+b\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{8\,\left (a^2-2\,a\,b+b^2\right )\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,\sqrt {-a\,b}\,\left (a+b\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}+\frac {\sqrt {-a\,b}\,\left (a+b\right )\,\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,b+2\,a\,b^2+5\,b^3\right )}{2\,\left (a^2-2\,a\,b+b^2\right )}+\frac {\left (\frac {2\,a^4\,b^2-8\,a^3\,b^3+12\,a^2\,b^4-8\,a\,b^5+2\,b^6}{a^3-3\,a^2\,b+3\,a\,b^2-b^3}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (a+b\right )\,\left (16\,a^5\,b^2-48\,a^4\,b^3+32\,a^3\,b^4+32\,a^2\,b^5-48\,a\,b^6+16\,b^7\right )}{8\,\left (a^2-2\,a\,b+b^2\right )\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )\,\sqrt {-a\,b}\,\left (a+b\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}\right )}{4\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )}}\right )\,\sqrt {-a\,b}\,\left (a+b\right )\,1{}\mathrm {i}}{2\,f\,\left (a^3\,b-2\,a^2\,b^2+a\,b^3\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(e + f*x)^2/(a + b*tan(e + f*x)^2)^2,x)

[Out]

tan(e + f*x)/(2*f*(a + b*tan(e + f*x)^2)*(a - b)) - (2*atan((((((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*
a^4*b^2)*1i)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) - (tan(e + f*x)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48
*a^4*b^3 + 16*a^5*b^2))/(2*(a^2 - 2*a*b + b^2)*(2*a^2 - 4*a*b + 2*b^2)))/(2*a^2 - 4*a*b + 2*b^2) + (tan(e + f*
x)*(2*a*b^2 + a^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b^2)))/(2*a^2 - 4*a*b + 2*b^2) - ((((2*b^6 - 8*a*b^5 + 12*a^2*
b^4 - 8*a^3*b^3 + 2*a^4*b^2)*1i)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) + (tan(e + f*x)*(16*b^7 - 48*a*b^6 + 32*a^2*b
^5 + 32*a^3*b^4 - 48*a^4*b^3 + 16*a^5*b^2))/(2*(a^2 - 2*a*b + b^2)*(2*a^2 - 4*a*b + 2*b^2)))/(2*a^2 - 4*a*b +
2*b^2) - (tan(e + f*x)*(2*a*b^2 + a^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b^2)))/(2*a^2 - 4*a*b + 2*b^2))/((((((2*b^
6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)*1i)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) - (tan(e + f*x)*(16*b^7
- 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48*a^4*b^3 + 16*a^5*b^2))/(2*(a^2 - 2*a*b + b^2)*(2*a^2 - 4*a*b + 2*b^2
)))*1i)/(2*a^2 - 4*a*b + 2*b^2) + (tan(e + f*x)*(2*a*b^2 + a^2*b + 5*b^3)*1i)/(2*(a^2 - 2*a*b + b^2)))/(2*a^2
- 4*a*b + 2*b^2) + (((((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)*1i)/(3*a*b^2 - 3*a^2*b + a^3 - b
^3) + (tan(e + f*x)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48*a^4*b^3 + 16*a^5*b^2))/(2*(a^2 - 2*a*b +
 b^2)*(2*a^2 - 4*a*b + 2*b^2)))*1i)/(2*a^2 - 4*a*b + 2*b^2) - (tan(e + f*x)*(2*a*b^2 + a^2*b + 5*b^3)*1i)/(2*(
a^2 - 2*a*b + b^2)))/(2*a^2 - 4*a*b + 2*b^2) + ((a*b)/2 + b^2/2)/(3*a*b^2 - 3*a^2*b + a^3 - b^3))))/(f*(2*a^2
- 4*a*b + 2*b^2)) - (atan((((-a*b)^(1/2)*(a + b)*((tan(e + f*x)*(2*a*b^2 + a^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b
^2)) - (((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) - (tan(e + f*x
)*(-a*b)^(1/2)*(a + b)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48*a^4*b^3 + 16*a^5*b^2))/(8*(a^2 - 2*a*
b + b^2)*(a*b^3 + a^3*b - 2*a^2*b^2)))*(-a*b)^(1/2)*(a + b))/(4*(a*b^3 + a^3*b - 2*a^2*b^2)))*1i)/(4*(a*b^3 +
a^3*b - 2*a^2*b^2)) + ((-a*b)^(1/2)*(a + b)*((tan(e + f*x)*(2*a*b^2 + a^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b^2))
+ (((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) + (tan(e + f*x)*(-a
*b)^(1/2)*(a + b)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48*a^4*b^3 + 16*a^5*b^2))/(8*(a^2 - 2*a*b + b
^2)*(a*b^3 + a^3*b - 2*a^2*b^2)))*(-a*b)^(1/2)*(a + b))/(4*(a*b^3 + a^3*b - 2*a^2*b^2)))*1i)/(4*(a*b^3 + a^3*b
 - 2*a^2*b^2)))/(((a*b)/2 + b^2/2)/(3*a*b^2 - 3*a^2*b + a^3 - b^3) - ((-a*b)^(1/2)*(a + b)*((tan(e + f*x)*(2*a
*b^2 + a^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b^2)) - (((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)/(3*a
*b^2 - 3*a^2*b + a^3 - b^3) - (tan(e + f*x)*(-a*b)^(1/2)*(a + b)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4
- 48*a^4*b^3 + 16*a^5*b^2))/(8*(a^2 - 2*a*b + b^2)*(a*b^3 + a^3*b - 2*a^2*b^2)))*(-a*b)^(1/2)*(a + b))/(4*(a*b
^3 + a^3*b - 2*a^2*b^2))))/(4*(a*b^3 + a^3*b - 2*a^2*b^2)) + ((-a*b)^(1/2)*(a + b)*((tan(e + f*x)*(2*a*b^2 + a
^2*b + 5*b^3))/(2*(a^2 - 2*a*b + b^2)) + (((2*b^6 - 8*a*b^5 + 12*a^2*b^4 - 8*a^3*b^3 + 2*a^4*b^2)/(3*a*b^2 - 3
*a^2*b + a^3 - b^3) + (tan(e + f*x)*(-a*b)^(1/2)*(a + b)*(16*b^7 - 48*a*b^6 + 32*a^2*b^5 + 32*a^3*b^4 - 48*a^4
*b^3 + 16*a^5*b^2))/(8*(a^2 - 2*a*b + b^2)*(a*b^3 + a^3*b - 2*a^2*b^2)))*(-a*b)^(1/2)*(a + b))/(4*(a*b^3 + a^3
*b - 2*a^2*b^2))))/(4*(a*b^3 + a^3*b - 2*a^2*b^2))))*(-a*b)^(1/2)*(a + b)*1i)/(2*f*(a*b^3 + a^3*b - 2*a^2*b^2)
)

________________________________________________________________________________________